﻿#parse("partials/headerpopup.html")
<script type="text/javascript">
    $(document).ready(function () {
        ///Search Doctor
        var oTable = $('#datalist').dataTable({
            "bSort": false,
            "sPaginationType": "full_numbers",
            "bProcessing": true,
            "bServerSide": true,
            "bFilter": true,
            "sAjaxSource": "tablelistdoctor",
            "aoColumns": [
                            { "mDataProp": "Id" },
                            { "mDataProp": "DoctorCode" },
                            { "mDataProp": "DoctorName" },
                            { "mDataProp": "Specialist" },
            //flag
                            {"mDataProp": "TotalAppointment" },
                            { "mDataProp": "PatientQueue" }
                        ],
            "aoColumnDefs": [
                                {
                                    "fnRender": function (o) {
                                        return "<center><a class='dok' title='Select Doctor' href='javascript:void(0)' doctorId='" + o.aData['Id'] + "' doctorName='" + o.aData['DoctorName'] + "' UserId='" + o.aData['UserId'] + "' ><img src='/images/Icons/table.png'/></a> </center>";

                                    },
                                    "aTargets": [0]
                                }
                        ],
            "fnServerData": function (sSource, aoData, fnCallback) {
                aoData.push({ "name": "doctorname", "value": $('#doctorname').val() });
                aoData.push({ "name": "code", "value": $('#code').val() });
                aoData.push({ "name": "TextBoxDoctorSpecialist", "value": $('#TextBoxDoctorSpecialist').val() });
                jQuery.ajax({
                    "dataType": 'json',
                    "type": "GET",
                    "url": "tablelistdoctor",
                    "data": aoData,
                    "success": function (data) {
                        if (data.ExceptionMessage != null) {
                            alert(data.ExceptionMessage);
                        } 
                        fnCallback(data);
                    }
                });
            }
        });

        function checkForEnter(event) {
            if (event.keyCode == 13) {
                oTable.fnDraw();
            }
        }

        $('#doctorname').keypress(checkForEnter);
        $('#code').keypress(checkForEnter);
        $('#buttonSearch').click(function () { oTable.fnDraw(); });

        //Add event click on list doctor
        $(".dok").live('click', function (event) {
            var doctorId = $(this).attr("doctorId");
            var doctorName = $(this).attr("doctorName");
            var UserId = $(this).attr("UserId");
            if (parent.IsDoctorHandler() == "1") {
                parent.setDoctorTextBox(doctorId, doctorName, UserId);
            } else {
                parent.setReferedDoctorTextBox(doctorId, doctorName, UserId);
            }
        });

    });
//End Document.ready
</script>
<style>
    div#datalist_filter 
    {
        display:none;
    }
    div#datalist_length 
    {
        display:none;
    }
    .mws-table thead 
    {
        margin-top:-10px;
    }
</style>
<div class="mws-form" action="#">
        <div class="mws-form-inline">
            <div class="mws-form-row">
                <label>
                    Doctor Name</label>
                <div class="mws-form-item small">
                    <input class="mws-textinput" id="doctorname" name="Name" type="text" value="" />
                </div>
            </div>
            <div class="mws-form-row">
                <label>
                    Code</label>
                <div class="mws-form-item small">
                    <input class="mws-textinput" id="code" name="Code" type="text" value="" />
                </div>
            </div>
            <div class="mws-form-row">
                <label>
                    Specialist</label>
                <div class="mws-form-item small">
                    <!--<input class="mws-textinput" id="TextBoxDoctorSpecialist" name="TextBoxDoctorSpecialist" type="text" value="" />-->
                     $ddlSpecialists
                </div>
            </div>
        </div>
        <br />
        <div class="mws-button-row">
            <input id="buttonSearch" class="mws-button red" type="submit" value="Search" />
        </div>
        <div class="mws-form-row">
            <table cellpadding="0" cellspacing="0" border="0" class="fullwidth mws-table" id="datalist"
                width="100%">
                <thead>
                    <tr>
                        <th style="width: 10px; text-align: center">
                            Actions
                        </th>
                        <th style="width: 100px;text-align: center">
                            CODE
                        </th>
                        <th style="text-align: center">
                            Doctor Name
                        </th>
                        <th style="text-align: center">
                            Specialist
                        </th>
                        <th style="width: 50px;text-align: center">
                            Total Appointment
                        </th>
                        <th style="width: 50px;text-align: center">
                            Patient Queue
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td colspan="7" class="dataTables_empty">
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
#parse("partials/footerpopup.html")
